<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const info = {
        age: 20,
      };
      // name: "jack",
      // 默认情况下定义属性的所有标志默认为false
      Object.defineProperty(info, "name", {
        value: "jack",
        writable: true,
        enumerable: true,
        configurable: true,
      });
      console.log(info);
      // info.name = "tom";
      // delete info.name;
      console.log(info);
      for (let k in info) {
        console.log(k);
      }

      // 查看info对象的age属性的标志
      const r = Object.getOwnPropertyDescriptor(info, "name");
      console.log(r);
    </script>
  </body>
</html>
